#ifndef DATACOLLECT_ECG_H
#define DATACOLLECT_ECG_H

#include <QWidget>
#include <qtimer.h>
#include <SeriaPortWork/serialworker.h>
#include "qcustomplot.h"

namespace Ui {
class DataCollect_ECG;
}

class DataCollect_ECG : public QWidget
{
    Q_OBJECT

public:
    explicit DataCollect_ECG(QWidget *parent = nullptr);
    ~DataCollect_ECG();

private slots:
    void startthread();
    void handleECGData(QVector<double> ecgdata, QVector<double> respdata);
    void handleEEGData(QVector<double> leftEEGdata, QVector<double> rightEEGdata, QVector<double> irdata, QVector<double> reddata);
private:
    Ui::DataCollect_ECG *ui;
    QTimer dataTimer;
    double graphTime;
    QCustomPlot *customPlot;
    SerialWorker *worker;
    // QThread *m_serialThread;
    QVector<double> m_xData, m_yData;
    double m_currentTime = 0.0;
    void setupSerialThread();
    void setupPlot();
};

#endif // DATACOLLECT_ECG_H
